@extends('admin.base')
	@section('content')
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            商品标签管理
            <small>mall genres of simple table</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="{{url('admin')}}"><i class="fa fa-dashboard"></i> 首页</a></li>
			@foreach($list as $k=>$pag)
			@if($k == 0)
            <li><a href='{{url("admin/pag/$pag->gid")}}'>本类商品标签信息</a></li>
			@endif
			@endforeach
            <li class="active">列表</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
			<div class="row">
				<div class="col-md-12">
					<div class="box">
						<div class="box-header with-border">
							<h3 class="box-title"><i class="fa fa-th"></i> 本类商品标签管理 </h3>
							<br><Br>
							<a class="btn btn-primary" href='{{url("admin/pag/create")}}?gid={{$pag->gid}}'>添加商品标签</a>
						</div><!-- /.box-header -->
						<div class="box-body">
							<table class="table table-bordered">
								<tr>	
								  <th>标签编号</th>
								  <th>标签名称</th>	
								  <th>标签值</th>		
								  <th>操作</th>
								</tr>
								@foreach($list as $pag)
								<tr>
								  <td>{{$pag->id}}</td>
								  <td>{{$pag->name}}</td>
								  <td>{{$pag->values}}</td>
								  <td><button onclick="doDel({{$pag->id}});" class="btn btn-xs btn-danger">删除</button> 
								  <a href='{{url("admin/pag/$pag->id/edit")}}' class="btn btn-xs btn-primary">更改</a></td>
								</tr>
								@endforeach
							</table>
							<form id="mydeleteform" method="post">
								<input type="hidden" name="_method" value="delete">
								<input type="hidden" name="_token" value="{{ csrf_token() }}">
							</form>
						</div><!-- /.box-body -->
						<div class="box-footer clearfix">
						  {!! $list->render() !!}
						</div>
					</div><!-- /.box -->
				</div><!-- /.col -->
			</div><!-- /.row -->
		</section><!-- /.content -->
	@endsection
	
	@section("myscript")
	<script type="text/javascript">
		function doDel(id){
            Modal.confirm({msg:'是否删除此类别？'}).on(function (e){
                if(e){
                    var form = document.getElementById("mydeleteform");
                    form.action = "{{URL('/admin/pag')}}/"+id;
                    form.submit(); 
                }
            });
        }
	</script>
	@endsection